package org.pearl.mp.danamic.service.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.pearl.mp.danamic.dao.OrderTblMapper;
import org.pearl.mp.danamic.entity.OrderTbl;
import org.pearl.mp.danamic.service.OrderTblService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author td
 * @since 2020-01-07
 */
@Service
@Slf4j
public class OrderTblServiceImpl extends ServiceImpl<OrderTblMapper, OrderTbl> implements OrderTblService {

    @Autowired
    OrderTblMapper orderTblMapper;

    @Override
    @DS("db_order")
    @Transactional
    public void insertOrder() {
        // 插入订单
        OrderTbl orderTbl = new OrderTbl();
        orderTbl.setUserId("12");
        orderTbl.setCommodityCode("IPHONE 13");
        orderTbl.setCount(1);
        orderTblMapper.insert(orderTbl);
        int i = 5 / 0;
    }
}
